package windbell.domain.risk.impl;

import edu.fudan.langlab.domain.task.TSKRoutineProtocal;
import edu.fudan.mylang.pf.BaseDAOService;
import org.eclipse.xtext.xbase.lib.ObjectExtensions;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.springframework.stereotype.Service;
import windbell.domain.risk.RiskCheckGenerator;
import windbell.domain.risk.RiskCheckGeneratorDAO;
import windbell.domain.risk.impl.RiskCheckGeneratorImpl;

@Service("windbell.domain.risk.RiskCheckGeneratorDAO")
public class RiskCheckGeneratorDAOImpl extends BaseDAOService<RiskCheckGenerator> implements RiskCheckGeneratorDAO {
  public RiskCheckGenerator create(final TSKRoutineProtocal protocal, final Procedure1<? super RiskCheckGenerator> init) {
    RiskCheckGenerator riskCheckGenerator=RiskCheckGeneratorImpl.create(getObjectFactory());
    
    final Procedure1<RiskCheckGenerator> _function = new Procedure1<RiskCheckGenerator>() {
        public void apply(final RiskCheckGenerator generator) {
          generator.setProtocal(protocal);
          init.apply(generator);
        }
      };
    RiskCheckGenerator _doubleArrow = ObjectExtensions.<RiskCheckGenerator>operator_doubleArrow(riskCheckGenerator, _function);
    return _doubleArrow;
  }
  
  public void delete(final RiskCheckGenerator generator) {getObjectFactory().delete(generator);
    
  }
}
